package com.lqm.entity.home;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * @program: HHHHHHHHHHHHHHHHHHHHHHH
 * @description
 * @author: lqm
 * @create: 2018-12-16 16:46
 */

@Entity
@Table(name = "project_score", schema = "crowdfunding", catalog = "")
public class ProjectScore {
    private Integer scoreId;
    private Double score;
    private String scoreContent;
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime=new Date();

    private HomeUser homeUser;
    @JsonBackReference
    private Project project;

    @Id
    @Column(name = "score_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getScoreId() {
        return scoreId;
    }

    public void setScoreId(Integer scoreId) {
        this.scoreId = scoreId;
    }


    @Basic
    @Column(name = "score", nullable = true, precision = 1)
    public Double getScore() {
        return score;
    }

    public void setScore(Double score) {
        this.score = score;
    }

    @Basic
    @Column(name = "score_content",  precision = 520)
    public String getScoreContent() {
        return scoreContent;
    }

    public void setScoreContent(String scoreContent) {
        this.scoreContent = scoreContent;
    }

    public Date getCreateTime() {
        return createTime;
    }
    @Basic
    @Column(name = "create_time")
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @ManyToOne
    @JoinColumn(name = "score_user_id", referencedColumnName = "id")
    public HomeUser getHomeUser() {
        return homeUser;
    }

    public void setHomeUser(HomeUser homeUser) {
        this.homeUser = homeUser;
    }

    @ManyToOne
    @JoinColumn(name = "score_project_id", referencedColumnName = "project_id")
    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    @Override
    public String toString() {
        return "ProjectScore{" +
                "scoreId=" + scoreId +
                ", score=" + score +
                ", scoreContent='" + scoreContent + '\'' +
//                ", homeUser=" + homeUser +
                ", project=" + project +
                '}';
    }
}
